<template>
	<view>
		<userProfile :userInfo="userInfo"/>
    <view class="vip-banner" v-if="!userInfo.is_svip">
      <view class="vip-banner_inner" @click="goSvip">
        <image mode="widthFix" class="vip-banner_img" :src="`${baseUrl}/avatar-client/images/mine_vip_banner.png`"></image>
      </view>
    </view>
    <diamondArea :userInfo="userInfo"/>
    <!-- <templateBanner /> -->
		<view class="cell-wrap">
			<view class="cell-inner">
				<u-cell-group :border="false">
					<u-cell-item title="必读秘笈" @click="goHelpPage(0)"></u-cell-item>
					<u-cell-item title="直播教学" @click="goHelpPage(1)"></u-cell-item>
          <!-- <u-cell-item title="批量地图生成器" @click="goFontImgGenerator()"></u-cell-item> -->
					<u-cell-item title="谐音词生成器" @click="goHelpPage(-1, '/pages/idiom-creator/idiom-creator')"></u-cell-item>
				</u-cell-group>
			</view>
		</view>
		<hm-tabbar :active-index="1"/>
	</view>
</template>
<script setup>
  import { ref } from 'vue'
  import { onShow } from '@dcloudio/uni-app'
	import userProfile from './components/user-profile.vue'
	import diamondArea from '/pages/creator/components/diamond-area'
  import templateBanner from './components/template-banner'
  const baseUrl = vk.getVuex('$app.config.staticUrl.baseUrl');
  
  
  let userInfo = ref({})
  onShow(() => {
    console.log(vk.pubfn.timeFormat(new Date()))
    vk.callFunction({
    	url: 'client/user/kh/walletOverview',
    	data: {},
    	success: (res) => {
    		userInfo.value = res.data
    	}
    });
  })
  
  let goHelpPage = (index, path) => {
    let helpLinks = [
      'https://avatar-1302621554.cos.ap-nanjing.myqcloud.com/help/index.html#/pages/platform-introduction/platform-introduction',
      'https://avatar-1302621554.cos.ap-nanjing.myqcloud.com/help/index.html#/pages/remote-learning/remote-learning'
    ]
	if (path) {
		uni.navigateTo({
		  url: path
		});
	} else {
		uni.navigateTo({
		  url: `/pages/web-view/web-view?webSrc=${helpLinks[index]}`
		});
	}
  }
  let goSvip = () => {
    vk.navigateTo({
      url: '/pages/creator/svip/svip'
    });
  }
  let goFontImgGenerator = () => {
    vk.navigateTo({
      url: '/pages/font-image-generator/black-text-on-white-bg'
    });
  }
</script>
<style lang="scss">
	.cell-wrap {
		margin-top: 30rpx;
		padding: 0 30rpx;
		.cell-inner {
			background: rgba(255, 255, 255, 1);
			box-shadow: 0px 17rpx 50rpx  rgba(233, 239, 245, 1);
		}
	}
  .vip-banner {
      margin-top: 70rpx;
      padding: 0 30rpx;
    .vip-banner_inner {
      .vip-banner_img {
        width: 100%;
      }
    }
  }
</style>